package com.liuzy.crawler;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wb.swt.SWTResourceManager;

import com.liuzy.crawler.core.Command;

/**
 * @author liuzy
 * @since 2015年9月23日
 */
public class Donate {
	/**
	 * @wbp.parser.entryPoint
	 */
	static void show(Shell shell) {
		Shell donate = new Shell(shell, SWT.PRIMARY_MODAL);
		donate.setSize(400, 300);
		donate.setText("设置");
		donate.setLocation(shell.getLocation().x + donate.getSize().x / 2, shell.getLocation().y + donate.getSize().y / 2);

		Composite alipay = new Composite(donate, SWT.NONE);
		alipay.setBounds(53, 45, 120, 120);
		alipay.setBackgroundImage(SWTResourceManager.getImage(Donate.class, "donate_alipay.png"));

		Composite weixin = new Composite(donate, SWT.NONE);
		weixin.setBackgroundImage(SWTResourceManager.getImage(Donate.class, "donate_weixin.png"));
		weixin.setBounds(226, 45, 120, 120);

		Label label = new Label(donate, SWT.NONE);
		label.setAlignment(SWT.CENTER);
		label.setBounds(74, 179, 80, 17);
		label.setText("支付宝捐助");

		Label label_1 = new Label(donate, SWT.NONE);
		label_1.setAlignment(SWT.CENTER);
		label_1.setBounds(247, 179, 80, 17);
		label_1.setText("微信捐助");

		Button button = new Button(donate, SWT.NONE);
		button.setBounds(128, 235, 139, 27);
		button.setText("去看看哪些人捐助了...");
		
		Label lblesc = new Label(donate, SWT.NONE);
		lblesc.setText("按ESC退出");
		lblesc.setBounds(340, 0, 58, 17);
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				Command.openBrowser("http://www.liuzhongyang.com/Crawler/");
			}
		});

		donate.open();
	}
}
